Function:  number

number(object)

The top-level function, number, converts the object argument to a string representing the object's value. If the value cannot be represented by a legitimate number, the "Not-a-Number" value, NaN is returned.

The object argument must be a JavaScript object. If no argument is provided, number returns zero, 0.

In this example, a new Boolean object is created with a string argument of "true". The number function returns, 1, which is the number equivalence of the value of the object.

Code:
boo = new Boolean("true")
document.write(Number(boo))

Output:
1

Copyright 2000 by Infinite Software Solutions, Inc.
Trademark Information